﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Tong;
public partial class aspnet_admin_bock_collect_CX_Collect_Replace : System.Web.UI.Page
{
    TongUse TextData = new TongUse();

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    //看看是不是要删除数据
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            LinkButton l = (LinkButton)e.Row.FindControl("LinkButton2");

            l.Attributes.Add("onclick", "javascript:return " +

            "confirm('您确定要操作 " +

            DataBinder.Eval(e.Row.DataItem, "Cx_Collect_Relace_Name") + "吗?')");

        }

    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Cx_Collect_Relace_Name.Text != "" && Cx_Collect_Relace_Name.Text.Length < 250 && TextData.SqlataSet("select Cx_Collect_Relace_Name from  [CX_Collect_Replace] where Cx_Collect_Relace_Name='" + Cx_Collect_Relace_Name.Text.Trim().Replace("'", "") + "'").Tables[0].Rows.Count == 0)
        {
            TextData.SqlDataSave("insert into [CX_Collect_Replace] (Cx_Collect_Relace_Name,Cx_Collect_Relace_Contont) values('" + Cx_Collect_Relace_Name.Text.Trim().Replace("'", "") + "','" + Cx_Collect_Relace_Contont.Text.Trim().Replace("'", "") + "')");
            tt.Text = "添加" + Cx_Collect_Relace_Name.Text + "成功";
            GridView1.DataSourceID = "SqlDataSource1";
            GridView1.DataBind();
        }
        else
        {
            tt.Text = "输入的关键字为空或超过250个或以存在相同关键字";
            GridView1.DataSourceID = "SqlDataSource1";
            GridView1.DataBind();
        }
    }



}
